//获取应用实例
const app = getApp();
// 引入AES.js
var baseJs = require("../../common/base.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    uid: "",
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.setData({
      uid: wx.getStorageSync('uid'),
    })

  },

  formSubmit: function(e) {
    var that = this;
    var uid = this.data.uid;
    console.log(e);
    wx.request({
      url: baseJs.api + baseJs.encryUrl("method=BusinessSalerSet&UID=" + uid + "&TrueName=" + e.detail.value.name + "&UserPhone=" + e.detail.value.phone + "&UserPassWord=" + e.detail.value.password + "&VerificationCode=" + e.detail.value.checkCode),
      success: function(res) {
        var json = JSON.parse(baseJs.decryUrl(res.data));
        console.log(json);
        if (json.ResultFlag == 1) {
          wx.showToast({
            title: "成功！",
            icon: 'none',
            duration: 2000
          });
          setTimeout(function() {
            wx.navigateTo({
              url: '/packageA/powerGive/powerGive',
            })
          }, 500)

        } else {
          wx.showToast({
            title: json.ResultMsg,
            icon: 'none',
            duration: 2000
          });
        }

      }
    })
  },
  formReset: function() {
    wx.navigateTo({
      url: '/packageA/powerGive/powerGive',
    })
  }
  // 
})